﻿@model List<Wicresoft.UnifyShow.Business.SiteBranchModel>
@{
    ViewBag.Title = "集中展现平台首页";
    Layout = "~/Views/Shared/_Layout.cshtml";
    decimal firstSiteID = Model.First().ID;
}
<script type="text/javascript">

var currentPageNumber=0;
var pageCount=0;

$(document).ready(function(){
    //$("#menu").children().first().addClass("VNavLeaf").addClass("ui-icons");
    $("#menu").children("li").click(function () {
        var childrens = $("#menu").children("li");
        childrens.removeClass("VNavLeaf ui-icons");
        $(this).addClass("VNavLeaf ui-icons");
    });
    $("#menu").children("li").click(function(){
       var siteID=$(this).attr("data-local");
       var url="@Url.Action("HomeContent")";
       url+="?siteID="+siteID;
       $(".main_right").load(url,function(){
       initContent();
       });
    });
    $("#menu").children().first().click();
    setInterval(internalChange,30000);  //30000  30秒钟一切换。
});

function internalChange()
{
var next=currentPageNumber+1;
if(next>pageCount) next=1;
showCategoryPage(next);
}

function showCategoryPage(i) {

    if (currentPageNumber != 0) {
        var pastObject = $($("#page").children()[currentPageNumber - 1]);
        var pastPageNumber = pastObject.attr("data-page")
        pastObject.removeClass("curr").empty().append('<a href="#' + pastPageNumber + '" >' + pastPageNumber + '</a>');
        var needHide = "#pageCategorysIndex" + currentPageNumber;
        $(needHide).hide("drop", { direction: "down" }, "slow");
    }
    $($("#page").children()[i - 1]).empty().addClass("curr").append(i);
    var needShow = "#pageCategorysIndex" + i;
    currentPageNumber = i;
    $(needShow).show("drop", { direction: "up" }, "slow");
  
}

function initContent() {
    currentPageNumber = 0;
    pageCount=$("#page").children().length;
    $(".pageClick").click(function () {
        showCategoryPage($(this).attr("data-page"));
    });
    showCategoryPage(1);
}

</script>
<div class="box">
    <div class="main_left">
        <div class="headpart ui-icons">
            <h3>
                全省范围分布</h3>
        </div>
        <div class="left_menu">
            <ul id="menu">
                @foreach (Wicresoft.UnifyShow.Business.SiteBranchModel sitebranch in Model)
                {
                    <li data-local="@sitebranch.ID" ><a href="#@sitebranch.ID">@sitebranch.Alias</a></li>
                }
            </ul>
        </div>
    </div>
    <div class="main_right">
        @Html.Action("HomeContent", new { siteID = int.Parse(firstSiteID.ToString()) })
    </div>
</div>
